<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var a = parseInt(prompt("请输入第一个值"));
      var b = parseInt(prompt("请输入第二个值"));
      var c = parseInt(prompt("请输入第三个值"));
      function fn() {
        var len = arguments.length;
        //a最大 b中间 c最小
        var a = arguments[0];
        var b;
        var c = arguments[0];
        for (var i = 1; i < len; ++i) {
          //找最大最小值
          if (arguments[i] > a) {
            a = arguments[i];
          }
          if (arguments[i] < c) {
            c = arguments[i];
          }
        }

        // 找中间值
        for (var i = 0; i < len; ++i) {
          if (arguments[i] > c && arguments[i] < a) {
            b = arguments[i];
            break;
          }
        }
        return [a, b, c];
      }

      document.write(fn(a, b, c));
    </script>
  </body>
</html>
